package com.sq.partner.manager.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.sq.partner.manager.controller.LoginController;
import com.sq.partner.manager.dao.BaseDao;
import com.sq.partner.manager.dao.CommonDao;
import com.sq.partner.manager.dao.IGatewayMenuDao;
import com.sq.partner.manager.dao.IGatewayMenuUriDao;
import com.sq.partner.manager.mybatis.model.GatewayMenu;
import com.sq.partner.manager.service.IGatewayMenuService;
import com.sq.partner.manager.util.LogUtil;
import com.sq.partner.manager.util.Page;
@Service
public class GatewayMenuServiceImpl implements IGatewayMenuService {
	private static Logger logger = LogUtil.getLog(LoginController.class);

	@Resource 
	private IGatewayMenuDao menuDao;
	@Resource
	private IGatewayMenuUriDao gatewayMenuUriDao;
	
	@Override
	public List<GatewayMenu> getAllMenus(long userid) throws Exception {
		return menuDao.getAllMenus(userid);
	}


	@Override
	public Page queryPage(Page page, Integer PageIndex, GatewayMenu menu)
			throws Exception {
		return menuDao.queryPage(page, PageIndex, menu);
	}


	@Override
	public boolean addMenu(GatewayMenu menu) throws Exception {
		return menuDao.addMenu(menu);
	}


	@Override
	public boolean modifyMenu(GatewayMenu menu) throws Exception {
		return menuDao.modifyMenu(menu);
	}


	@Override
	public List<GatewayMenu> getAllMenusExceptSelf(Long menuid)
			throws Exception {
		return menuDao.getAllMenusExceptSelf(menuid);
	}


	@Override
	public boolean deleteMenu(Long menuid) throws Exception {
		gatewayMenuUriDao.delMenuUriByMenuid(menuid);
		return menuDao.deleteMenu(menuid);
	}


	@Override
	public List<GatewayMenu> queryChildMenuIsExists(Long parentMenuid)
			throws Exception {
		return menuDao.queryChildMenuIsExists(parentMenuid);
	}


	@Override
	public List<GatewayMenu> queryAllMenuIsAsParentMenu(Map<String, Object> map)
			throws Exception {
		return menuDao.queryAllMenuIsAsParentMenu(map);
	}


	@Override
	public GatewayMenu queryMenuInfo(Long menuid) throws Exception {
		return menuDao.queryMenuInfo(menuid);
	}
	
	
	

}
